function computeRepeatRatio(cash, ratio, year){
    const out = {
        total: 0,
        originCash: cash * year,
        totalStep: [],
        yearList: [],
    };
 
    while(year-- > 0){
        out.total = (cash + out.total) * (100 + ratio)/100;
        out.totalStep.push(out.total);
    }

    out.originStep = out.totalStep.map((e, idx) => {
        out.yearList.push(idx + 1)
        return cash * (idx + 1)
    });
    out.ratioStep = out.totalStep.map((e, idx) => Math.round(out.totalStep[idx] * 100/out.originStep[idx]) - 100);
    return out;
}

export {
    computeRepeatRatio,
}